package entity;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.util.Collection;
import java.util.ArrayList;
import javax.persistence.ManyToMany;
import javax.persistence.CascadeType;
import javax.persistence.OneToMany;

@Entity
public class AccessRole implements Serializable {

    @Id
    private String roleType;
    private String description;
    @OneToMany(cascade = {CascadeType.PERSIST})
    private Collection<AccessControl> accessControls = new ArrayList<AccessControl>();

    public AccessRole() {
    }

    public AccessRole(String roleType, String description) {
        this.roleType = roleType;
        this.description = description;
    }

    public String getRoleType() {
        return roleType;
    }

    public void setRoleType(String roleType) {
        this.roleType = roleType;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @ManyToMany(cascade = {CascadeType.PERSIST})
    public Collection<AccessControl> getAccessControls() {
        return accessControls;
    }

    public void setAccessControls(Collection<AccessControl> accessControls) {
        this.accessControls = accessControls;
    }
}
